* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 标题区域 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 0;
    flex: 1;
    text-align: center;
}

.btn-settings {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: rotate(90deg);
}

.btn-settings:active {
    transform: rotate(90deg) scale(0.95);
}

.status-disconnected {
    color: #ff6b6b;
    font-weight: bold;
}

.status-connected {
    color: #51cf66;
    font-weight: bold;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

/* DSA影像窗口 */
.dsa-window {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dsa-window h2 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 比例 */
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #667eea;
}

.dsa-video,
.dsa-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

#dsa-canvas {
    border: 3px solid #667eea;
    border-radius: 8px;
    background: #f8f9fa;
    width: 100%;
    height: auto;
    display: block;
}

.dsa-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    color: #666;
    font-size: 0.95em;
}

/* 控制面板 */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-panel h2 {
    color: #667eea;
    font-size: 1.5em;
}

.control-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid #667eea;
}

.control-section h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.control-group label {
    font-weight: 600;
    min-width: 50px;
}

.slider {
    flex-grow: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#guidewire-speed-value,
#catheter-speed-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

/* 按钮组 */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.button-group:last-child {
    margin-bottom: 0;
}

/* 按钮样式 */
.btn {
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
}

.btn-icon {
    font-size: 1.2em;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
}

.btn-success:hover {
    background: linear-gradient(135deg, #40c057 0%, #2f9e44 100%);
}

.btn-warning {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #333;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffec99 0%, #fcc419 100%);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #748ffc 0%, #845ef7 100%);
}

.btn-info {
    background: linear-gradient(135deg, #4c6ef5 0%, #4263eb 100%);
}

.btn-info:hover {
    background: linear-gradient(135deg, #748ffc 0%, #5677d8 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #fa5252 100%);
    font-size: 1.05em;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff8787 0%, #ff7575 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #868e96 0%, #748087 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #a5adb5 0%, #909297 100%);
}

.btn-light {
    background: #e9ecef;
    color: #333;
}

.btn-light:hover {
    background: #dee2e6;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 日志窗口 */
.log-window {
    background: #f8f9fa;
    padding: 20px;
    border-top: 2px solid #e9ecef;
}

.log-window h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.log-content {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    height: 150px;
    overflow-y: auto;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #333;
}

.log-item {
    padding: 5px 0;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    gap: 10px;
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    color: #868e96;
    min-width: 100px;
}

.log-message {
    flex-grow: 1;
}

.log-success {
    color: #2f9e44;
}

.log-error {
    color: #fa5252;
}

.log-info {
    color: #4263eb;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2em;
    }

    .button-group {
        grid-template-columns: 1fr;
    }
}

/* 模态对话框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.modal-close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
}

.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    color: #333;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-group label {
    font-weight: 600;
    color: #333;
}

.settings-input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    transition: border-color 0.2s ease;
}

.settings-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.settings-hint {
    font-size: 0.85em;
    color: #868e96;
    margin-top: 5px;
}

.current-settings {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.current-settings p {
    margin: 8px 0;
    font-size: 0.95em;
}

.current-settings strong {
    color: #333;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }

    .header-top {
        flex-direction: column;
        gap: 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .btn-settings {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

@media (max-width: 640px) {
    .container {
        border-radius: 0;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .main-content {
        padding: 15px;
        gap: 15px;
    }

    .control-section {
        padding: 15px;
    }

    .log-content {
        height: 100px;
    }
}
